
package com.android.finaltracer.ui;

import android.content.Context;
import android.content.Intent;

import com.android.finaltracer.model.PositionInfo;
import com.android.finaltracer.util.FinalTracerIntents;

public class Map {
    private static Map instance;
    private Context mContext;

    private Map(Context context) {
        mContext = context;
    }

    public static Map getInstance(Context context) {
        if (instance == null) {
            instance = new Map(context);
        }
        return instance;
    }

    public void showGpsPositionAtMap(String phoneNum, PositionInfo position) {
        Intent intent = new Intent(FinalTracerIntents.ACTION_UPDATE_POSITION);

        intent.putExtra(FinalTracerIntents.UPDATE_POSITION_PHONENUM, phoneNum);
        intent.putExtra(FinalTracerIntents.UPDATE_POSITION_LATITUDE,
                position.getLatitude());
        intent.putExtra(FinalTracerIntents.UPDATE_POSITION_LONGITUDE,
                position.getLongitude());

        mContext.sendBroadcast(intent);
    }
}
